//C06:Constructor1.cpp
// Constructors & destructors
#include <iostream>
using namespace std;

class Tree
{
    int height;
    public:
        Tree(int initialHeight);    // Constructor
        ~Tree();    // Destructor
        void grow(int years);
        void printsize();
};

Tree::Tree(int initialHeight)
{
    height= initialHeight;
}

Tree::~Tree()
{
    cout << "inside Tree destructor " << '\n';
    printsize();
}

void Tree::grow(int years)
{
    height += years;
}

void Tree::printsize()
{
    cout << "Tree height is " << height << '\n';
}

int main(void)
{
    cout << "before opening brace " << '\n';
    {
        Tree t(12);
        cout << "after Tree creation" << '\n';
        t.printsize();
        t.grow(4);
        cout << "after closing brace" << '\n';
    }
    cout << "after closing brace" << '\n';
    return 0;
}